<template>
  <div class="app-container">

    <div v-for="item in list" :key="item.id">
      <div v-html="item.content"></div>
    </div>

  </div>
</template>
<script>
import article from "@/api/article/article"
export default{
  data(){
    return{
      list:null,//查询后的接口集合
      page:1,//当前页
      limit:100,//每页记录总数
      total:0,//总记录数
      input: ''
    }
  },
  created(){
    this.getList()
  },
  methods:{
    getList(page=1){
      this.page=page
      article.pageArticle(this.page,this.limit)
        .then(response=>{
          this.list=response.data.rows
          this.total=response.data.total
        })
    },
    removeDataById(id){
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        article.deleteArticleById(id)
          .then(response=>{
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
          })
        //刷新页面
        this.getList();
      })
    },
    pushById(id){
        article.push(id)
          .then(response=>{
            this.$message({
              type: 'success',
              message: '推送成功!'
            });
          })
    }
  }
}
</script>
